package com.example.websocket.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 外部配置的定时任务执行时机的定时器
 *
 * @author raos
 * @date 2024-03-08 17:18
 */
@Slf4j
@EnableScheduling
@Component
@PropertySource(value = "file:config/task.yml",encoding = "UTF-8")
public class TestTask {

    @Scheduled(cron = "${task-expire-cron}")
    public void run() {
        log.info("外部定时动态配置触发=【{}】", System.currentTimeMillis());
    }

}
